﻿@model Upload2.Models.Up

@{
  ViewBag.Title = "Create";
}
<h2>Create</h2>


@using (Html.BeginForm())
{
  @Html.AntiForgeryToken()

  <div class="form-horizontal">
    <h5>此页功能，包括压缩上传图片和上传普通文件</h5>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
      @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
      <div class="col-md-10">
        @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control", placeholder = "标题" } })
        @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
      </div>
    </div>

    <!--上传单个图片-->
    <div class="form-group">
      @Html.LabelFor(model => model.AttachmentPic, htmlAttributes: new { @class = "control-label col-md-2" })
      <div class="row">
        <div class="col-md-offset-2">
            <ul class="col-md-offset-2 list-unstyled ul0">
                <!--上传的图片显示位置-->
                <li>
                    <label for="file0" style="width:60px;height:60px;line-height:60px;font-size:32px;text-align:center;border:1px dotted #aaa;">+</label>
                    <input type="file" id="file0" name="file0" style="display:none;" />
                </li>
                @*<li>
          <div style="width:60px;height:60px;overflow:hidden">
            <img src="~/Content/Images/bike.png" class="upimg" style="width:60px;height:60px;" />
            <div onclick="remove(this)" style="position:relative;top: -70px;right: -40px;color:#fff;background-color: rgba(0,0,0,0.7);width:30px;height: 30px;border-radius: 50%;margin-top:-3px;padding-top:10px;cursor:pointer;">&nbsp;&nbsp;&times;</div>
          </div>
        </li>*@
            </ul>
          @Html.HiddenFor(model => model.AttachmentPic)
        </div>
      </div>
    </div>

    <!--上传单个普通附件-->
    <div class="form-group">
      @Html.LabelFor(model => model.AttachmentFile, htmlAttributes: new { @class = "control-label col-md-2" })
      <div class="row">
        <div class="col-md-offset-2">
          <ul class="col-md-offset-2 list-unstyled ul0">
            <!--+号图标位置-->
            <li>
                <label for="file1" style="width:60px;height:60px;line-height:60px;font-size:32px;text-align:center;border:1px dotted #aaa;">+</label>
                <input type="file" id="file1" name="file1" style="display:none;" />
            </li>
          </ul>
          @Html.HiddenFor(model => model.AttachmentFile)
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="row" style="margin:5px 15px;">
        <ul class="col-md-offset-2 list-group ul1">
          <!--上传的文件显示位置-->
          @*<li class="list-group-item"><span style="white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:inline-block;width:90%">在秀一工夺在三在很久很久以前，有一个阿拉伯的故事，故事的内容是这样的：从前有座山，山里有个庙，庙里有个老和尚给小和尚讲故事讲的什么呢工有地在城.png</span><span><button type="button" class="close" aria-label="Close" onclick="remove(this)"><span aria-hidden="true">&times;</span></button></span></li>*@
        </ul>
      </div>
    </div>

    <!--上传图片和文件（最多N个）-->
    <div class="form-group">
      @Html.LabelFor(model => model.AttachmentPaths, htmlAttributes: new { @class = "control-label col-md-2" })
      <div class="row">
        <div class="col-md-offset-2">
            <ul class="col-md-offset-2 list-unstyled ul0">
                <!--上传的图片显示位置-->
                <li>
                    <label for="file2" style="width:60px;height:60px;line-height:60px;font-size:32px;text-align:center;border:1px dotted #aaa;">+</label>
                    <input type="file" id="file2" name="file2" style="display:none;" />
                </li>
                @*<li>
          <div style="width:60px;height:60px;overflow:hidden">
            <img src="~/Content/Images/bike.png" class="upimg" style="width:60px;height:60px;" />
            <div onclick="remove(this)" style="position:relative;top: -70px;right: -40px;color:#fff;background-color: rgba(0,0,0,0.7);width:30px;height: 30px;border-radius: 50%;margin-top:-3px;padding-top:10px;cursor:pointer;">&nbsp;&nbsp;&times;</div>
          </div>
        </li>*@
            </ul>
          @Html.HiddenFor(model => model.AttachmentPaths)
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="row" style="margin:5px 15px;">
        <ul class="col-md-offset-2 list-group ul1">
          <!--上传的文件显示位置-->
          @*<li class="list-group-item"><span style="white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:inline-block;width:90%">在秀一工夺在三在很久很久以前，有一个阿拉伯的故事，故事的内容是这样的：从前有座山，山里有个庙，庙里有个老和尚给小和尚讲故事讲的什么呢工有地在城.png</span><span><button type="button" class="close" aria-label="Close" onclick="remove(this)"><span aria-hidden="true">&times;</span></button></span></li>*@
        </ul>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-offset-2 col-md-10">
        <input type="submit" value="Create" class="btn btn-default" />
      </div>
    </div>
  </div>
}

<div>
  @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
  @Scripts.Render("~/bundles/jqueryval")
  <script src="~/Scripts/upload0.js"></script>
  <script src="~/Scripts/upload1.js"></script>
  <script src="~/Scripts/upload2.js"></script>
  <script>
    $('.upimg').viewer({
      toolbar: false,
      navbar: false
    });
  </script>
}
